<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<p>json中，判断键是否存在</p>
	</body>
	<script type="text/javascript">
		var data = {
			"name":"zhang"
		}
		console.log("age" in data);
		console.log(data.age);
		console.log(data.hasOwnProperty("age"));
		if(data.age){
			console.log(data.age);
		}else{
			console.log(data.name)
		}
	</script>
</html>
